package com.touchalachs.core.ui;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;

public class Label extends BasicUIElement {

	private boolean showBorders = false;
	private volatile int fontSize = 32;
	private volatile int color = Color.WHITE;
	private volatile String text;
	
	/**
	 * relative size 0..100
	 */
	public Label(int x, int y, int w, int h, String text, Point screenSize) {
		super(x, y, w, h, screenSize);
		this.text = text;
	}
	
	public void setText(String text){
		this.text = text;
	}

	@Override
	public void draw(Canvas canvas) {
		Paint p = new Paint();
		
		if (showBorders ){
			p.setARGB(255, 255, 64, 64);
			canvas.drawRect(getDimension(), p);
		}
		
		p.setColor(color);
		p.setTextSize(fontSize);
		canvas.drawText(text, getX()+1, getY()+2+fontSize, p);
	}

	/**
	 * {@link #fontSize}
	 */
	public void setTextSize(int fontSize) {
		this.fontSize = fontSize;
	}
	public void setTextColor(int color) {
		this.color = color;
	}



}
